import sys
import os


def solve():
    # 读取输入
    n = int(input())  # 鞭炮数量
    ranges = list(map(int, input().split()))  # 每个鞭炮的爆炸范围
    ranges.sort()
    big = sum(ranges) - ranges[0]
    # print(big)
    if n == 1:
        print(0, 0)
    if n == 2:      
        print(1, big)
    small = ranges[0] + 1
    one_before = 1
    # two_before = 0
    for i in range(3, n):
        temp = small
        small = one_before + ranges[i - 2] + 1
        one_before = temp
        # print(i,one_before, ranges[i-2], small)

    print(small, big)



# 调用函数解决问题
solve()
